package com.homedo.async.mysql.support.repository;

import com.homedo.async.common.dto.Pagination;
import io.vertx.sqlclient.SqlConnection;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;

/**
 * @author jgshun
 * @date 2020/3/19 4:43 PM
 */
public interface ReactivePaginationRepositoryI<T, ID> {


    Mono<Pagination<T>> findAll2Pagination(Pagination<T> pagination);

    Mono<Pagination<T>> findByRecordSelective2Pagination(T entity, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecordSelective2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecordsSelective2Pagination(Iterable<? extends T> entities, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecordsSelective2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecord2Pagination(T entity, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecord2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecords2Pagination(Iterable<? extends T> entities, Pagination<T> pagination);

    Mono<Pagination<T>> findByRecords2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination);


    //=== 传入 Connection 是为了统一获得事务能力

    Mono<Pagination<T>> findAll2Pagination(Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecordSelective2Pagination(T entity, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecordSelective2Pagination(Publisher<? extends T> entity, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecordsSelective2Pagination(Iterable<? extends T> entities, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecordsSelective2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecord2Pagination(T entity, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecord2Pagination(Publisher<? extends T> entity, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecords2Pagination(Iterable<? extends T> entities, Pagination<T> pagination, SqlConnection connection);

    Mono<Pagination<T>> findByRecords2Pagination(Publisher<? extends T> entityStream, Pagination<T> pagination, SqlConnection connection);


}
